package com.mimi.practice.database.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.mimi.practice.database.bean.PairDevEntity

@Dao
interface PairDevEntityDao {
    // 插入数据
    @Insert
    suspend fun insert(pairDevEntity: PairDevEntity): Long

    // 更新数据
    @Update
    suspend fun update(pairDevEntity: PairDevEntity)

    // 删除数据
    @Delete
    suspend fun delete(pairDevEntity: PairDevEntity)

    // 根据 ID 查询单个实体
    @Query("SELECT * FROM PairDevEntity WHERE id = :id")
    suspend fun getPairDevById(id: Long): PairDevEntity?

    // 查询所有实体
    @Query("SELECT * FROM PairDevEntity")
    suspend fun loadAll(): List<PairDevEntity>

    // 根据 UUID 查询单个实体
    @Query("SELECT * FROM PairDevEntity WHERE uuid = :uuid")
    suspend fun loadAllByUuid(uuid: String): PairDevEntity?
}